package com.glsc.ngateway.common.api.flowable.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.glsc.ngateway.common.api.flowable.dto.task.FlowFormBaseEntityDto;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDate;

/**
 * @author zhengyr
 * @date 2023/8/2-14:44
 * 新增的CPU规格明细数据
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class FlowFormCPUInDetailDto extends FlowFormBaseEntityDto {

    @Builder.Default
    private Integer detailIndex = 1;
    //资产名称，对应oa下拉框
    private Integer asset;

    private Integer location;

    private BigDecimal inputPriceWithTax;

    private BigDecimal inputPriceNoTax;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    private LocalDate purchaseDate;

    private String user;

    private String cpuStandardCode;

    private String partNum;
//    @Column(name = "cpu_standard_name", length = 100, columnDefinition = "varchar(100) DEFAULT NULL COMMENT 'cpu规格名称'")
//    private String cpuStandardName;

    private String sn;

    @Builder.Default
    private Integer lifeStatus = 0;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    private LocalDate manufactDate;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    private LocalDate expirateDate;

    private Integer locationId;
}
